package com.miao.controller
{
	import com.miao.view.DownLoadManagerMediator;
	import com.miao.view.FlvPlayerMediator;
	import com.miao.view.SwfPlayerMediator;
	
	import org.puremvc.as3.multicore.interfaces.ICommand;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.command.SimpleCommand;
	
	public class SourceCompleteCommand extends SimpleCommand implements ICommand
	{
		
		override public function execute(note:INotification):void{
			var swfPlayer:SwfPlayerMediator = facade.retrieveMediator(SwfPlayerMediator.NAME) as SwfPlayerMediator;
			var flvPlayer:FlvPlayerMediator = facade.retrieveMediator(FlvPlayerMediator.NAME) as FlvPlayerMediator;
			var dlm:DownLoadManagerMediator = facade.retrieveMediator(DownLoadManagerMediator.NAME) as DownLoadManagerMediator;
			
			var rawUrl:String = note.getBody() as String;
			
			if(swfPlayer.isShown&&swfPlayer.currentUrl==rawUrl){
				swfPlayer.showLoading=false;
				swfPlayer.load(dlm.getLocalPath(rawUrl));
			}
			if(flvPlayer.isShown&&flvPlayer.currentUrl==rawUrl){
				flvPlayer.showLoading=false;
				flvPlayer.load(dlm.getLocalPath(rawUrl));
			}
		}
		
	}
}